-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[win][aarch64] Fix linking statics on Arm64EC, take 2 #142742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+197
−51
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR modifies cc @jieyouxu Some changes occurred in compiler/rustc_codegen_ssa |
bjorn3
reviewed
Jun 19, 2025
8463164
to
fec0e2a
Compare
@bors2 try jobs=x86_64-msvc-,x86_64-mingw-,dist-aarch64-msvc |
rust-bors bot
added a commit
that referenced
this pull request
Jun 20, 2025
[win][aarch64] Fix linking statics on Arm64EC, take 2 Arm64EC builds recently started to fail due to the linker not finding a symbol: ``` symbols.o : error LNK2001: unresolved external symbol #_ZN3std9panicking11EMPTY_PANIC17hc8d2b903527827f1E (EC Symbol) C:\Code\hello-world\target\arm64ec-pc-windows-msvc\debug\deps\hello_world.exe : fatal error LNK1120: 1 unresolved externals ``` It turns out that `EMPTY_PANIC` is a new static variable that was being exported then imported from the standard library, but when exporting LLVM didn't prepend the name with `#` (as only functions are prefixed with this character), whereas Rust was prefixing with `#` when attempting to import it. The fix is to have Rust not prefix statics with `#` when importing. Adding tests discovered another issue: we need to correctly mark static exported from dylibs with `DATA`, otherwise MSVC's linker assumes they are functions and complains that there is no exit thunk for them. Fixes #138541 Resurrects #140176 now that #141061 is merged, which removes the incompatibility with `__rust_no_alloc_shim_is_unstable`. r? `@wesleywiser` CC `@bjorn3` try-job: x86_64-msvc-
💔 Test failed
|
bjorn3
reviewed
Jun 20, 2025
@bors2 try jobs= Edit: Seems to be rust-lang/bors#314 |
Unknown value for argument "jobs". |
You'll need to use the try-job-in-PR-description form |
@bors2 try |
rust-bors bot
added a commit
that referenced
this pull request
Jun 20, 2025
[win][aarch64] Fix linking statics on Arm64EC, take 2 Arm64EC builds recently started to fail due to the linker not finding a symbol: ``` symbols.o : error LNK2001: unresolved external symbol #_ZN3std9panicking11EMPTY_PANIC17hc8d2b903527827f1E (EC Symbol) C:\Code\hello-world\target\arm64ec-pc-windows-msvc\debug\deps\hello_world.exe : fatal error LNK1120: 1 unresolved externals ``` It turns out that `EMPTY_PANIC` is a new static variable that was being exported then imported from the standard library, but when exporting LLVM didn't prepend the name with `#` (as only functions are prefixed with this character), whereas Rust was prefixing with `#` when attempting to import it. The fix is to have Rust not prefix statics with `#` when importing. Adding tests discovered another issue: we need to correctly mark static exported from dylibs with `DATA`, otherwise MSVC's linker assumes they are functions and complains that there is no exit thunk for them. Fixes #138541 Resurrects #140176 now that #141061 is merged, which removes the incompatibility with `__rust_no_alloc_shim_is_unstable`. r? `@wesleywiser` CC `@bjorn3` -- try-job: x86_64-msvc-* try-job: x86_64-mingw-* try-job: dist-aarch64-msvc
bjorn3
reviewed
Jun 20, 2025
fec0e2a
to
a6794f1
Compare
This comment has been minimized.
This comment has been minimized.
a6794f1
to
36bf05c
Compare
bjorn3
reviewed
Jun 23, 2025
r=me with the above change |
36bf05c
to
2602653
Compare
@bors r+ |
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this pull request
Jun 24, 2025
[win][aarch64] Fix linking statics on Arm64EC, take 2 Arm64EC builds recently started to fail due to the linker not finding a symbol: ``` symbols.o : error LNK2001: unresolved external symbol #_ZN3std9panicking11EMPTY_PANIC17hc8d2b903527827f1E (EC Symbol) C:\Code\hello-world\target\arm64ec-pc-windows-msvc\debug\deps\hello_world.exe : fatal error LNK1120: 1 unresolved externals ``` It turns out that `EMPTY_PANIC` is a new static variable that was being exported then imported from the standard library, but when exporting LLVM didn't prepend the name with `#` (as only functions are prefixed with this character), whereas Rust was prefixing with `#` when attempting to import it. The fix is to have Rust not prefix statics with `#` when importing. Adding tests discovered another issue: we need to correctly mark static exported from dylibs with `DATA`, otherwise MSVC's linker assumes they are functions and complains that there is no exit thunk for them. Fixes rust-lang#138541 Resurrects rust-lang#140176 now that rust-lang#141061 is merged, which removes the incompatibility with `__rust_no_alloc_shim_is_unstable`. r? `@wesleywiser` CC `@bjorn3`
bors
added a commit
that referenced
this pull request
Jun 24, 2025
Rollup of 8 pull requests Successful merges: - #140622 (compiletest: Improve diagnostics for line annotation mismatches) - #142641 (Generate symbols.o for proc-macros too) - #142695 (Port `#[rustc_skip_during_method_dispatch]` to the new attribute system) - #142742 ([win][aarch64] Fix linking statics on Arm64EC, take 2) - #142894 (phantom_variance_markers: fix identifier usage in macro) - #142928 (Fix hang in --print=file-names in bootstrap) - #142930 (Account for beta revisions when normalizing versions) - #142932 (rustdoc-json: Keep empty generic args if parenthesized) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Jun 24, 2025
Rollup of 7 pull requests Successful merges: - #137268 (Allow comparisons between `CStr`, `CString`, and `Cow<CStr>`.) - #142704 (Remove the deprecated unstable `concat_idents!` macro) - #142742 ([win][aarch64] Fix linking statics on Arm64EC, take 2) - #142843 (Enable reproducible-build-2 for Windows MSVC) - #142916 (rustdoc-json: Add test for `#[optimize(..)]`) - #142919 (rustdoc-json: Add test for `#[cold]`) - #142944 (Stats output tweaks) Failed merges: - #142825 (Port `#[track_caller]` to the new attribute system) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Jun 24, 2025
Rollup merge of #142742 - dpaoliello:arm64eclinking, r=bjorn3 [win][aarch64] Fix linking statics on Arm64EC, take 2 Arm64EC builds recently started to fail due to the linker not finding a symbol: ``` symbols.o : error LNK2001: unresolved external symbol #_ZN3std9panicking11EMPTY_PANIC17hc8d2b903527827f1E (EC Symbol) C:\Code\hello-world\target\arm64ec-pc-windows-msvc\debug\deps\hello_world.exe : fatal error LNK1120: 1 unresolved externals ``` It turns out that `EMPTY_PANIC` is a new static variable that was being exported then imported from the standard library, but when exporting LLVM didn't prepend the name with `#` (as only functions are prefixed with this character), whereas Rust was prefixing with `#` when attempting to import it. The fix is to have Rust not prefix statics with `#` when importing. Adding tests discovered another issue: we need to correctly mark static exported from dylibs with `DATA`, otherwise MSVC's linker assumes they are functions and complains that there is no exit thunk for them. Fixes #138541 Resurrects #140176 now that #141061 is merged, which removes the incompatibility with `__rust_no_alloc_shim_is_unstable`. r? ``@wesleywiser`` CC ``@bjorn3``
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-run-make
Area: port run-make Makefiles to rmake.rs
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Arm64EC builds recently started to fail due to the linker not finding a symbol:
It turns out that
EMPTY_PANIC
is a new static variable that was being exported then imported from the standard library, but when exporting LLVM didn't prepend the name with#
(as only functions are prefixed with this character), whereas Rust was prefixing with#
when attempting to import it.The fix is to have Rust not prefix statics with
#
when importing.Adding tests discovered another issue: we need to correctly mark static exported from dylibs with
DATA
, otherwise MSVC's linker assumes they are functions and complains that there is no exit thunk for them.Fixes #138541
Resurrects #140176 now that #141061 is merged, which removes the incompatibility with
__rust_no_alloc_shim_is_unstable
.r? @wesleywiser
CC @bjorn3